package com.zmn.oms.third.koubei;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import org.springframework.stereotype.Component;

/**
 * 口碑渠道常量定义类
 *
 * @author xiewenbing
 * @date 2021/08/16
 */
@Component
public class KoubeiConsts {

    /**
     * 渠道名称
     */
    public final static String CHANNEL_NAME = "平台渠道G2-G8到家(口碑系列渠道)";

    /**
     * 渠道对接开关
     */
    public static boolean POWER_ON = false;

    /**
     * app key
     */
    public static String APP_KEY = "32986202";

    /**
     * app secret
     */
    public static String APP_SECRET = "8e4844bc1b76a7621d595b314b59ed48";

    /**
     * api url
     */
    public static String API_URL = "https://eco.taobao.com/router/rest";

    /**
     * 签名验证失败代码
     */
    public final static String VERIFY_SIGN_FAILED_CODE = "sign-check-failure";

    /**
     * 签名验证失败消息
     */
    public final static String VERIFY_SIGN_FAILED_MSG = "Illegal request";

    /**
     * 系统错误失败代码
     */
    public final static String HANDLE_FAILED_CODE = "SYSTEM_ERROR";

    /**
     * 创建订单
     */
    public final static String METHOD_ORDER_CREATE = "qimen.taobao.life.reservation.order.door.create";


    /**
     * 预约时段库存查询
     */
    public final static String METHOD_RESERVATION_QUERY = "qimen.taobao.life.reservation.item.date.inventory.query";

    /**
     * 取消
     */
    public final static String SYNC_ACTION_CANCEL = "CANCEL";

    /**
     * 改约
     */
    public final static String SYNC_ACTION_MODIFY = "MODIFY";

    /**
     * 推进履约
     */
    public final static String SYNC_ACTION_PUSH = "PUSH_FULFILLMENT";

    /**
     * 履约状态，已准备 - 领单
     */
    public final static String SYNC_STATUS_PREPARED = "PREPARED";

    /**
     * 履约状态，处理中 - 上门
     */
    public final static String SYNC_STATUS_PROCESSING = "PROCESSING";

    /**
     * 履约状态，已准备 - 完成
     */
    public final static String SYNC_STATUS_PROCESSED = "PROCESSED";

    /**
     * 库存查询最大天数 - 15天
     */
    public final static int INVENTORY_MAX_DAY = 15;

    /**
     * 库存查询库存量 - 200
     */
    public final static int INVENTORY_NUMBER = 200;

    /**
     * 预约库存时间段
     */
    public final static int INVENTORY_TIME_SECTION_NUMBER = 6;

    /**
     * 库存查询状态 - 约满
     */
    public final static String INVENTORY_STATUS_FULL = "FULL";

    /**
     * 库存查询状态 - 有剩余
     */
    public final static String INVENTORY_STATUS_OPEN = "OPEN";

    /**
     * 库存查询状态 - 未开放
     */
    public final static String INVENTORY_STATUS_CLOSE = "CLOSE";

    /**
     * 库存查询预约开始时间（小时）
     */
    public final static int INVENTORY_HOUR_START = 8;

    /**
     * 渠道预付金额
     */
    public static int PREPAY_MONEY = 0;

    /******************************动态配置参数**************************************/
    @NacosValue(value = "${koubei.api.powerOn:false}", autoRefreshed = true)
    public void setPowerOn(boolean powerOn) {
        POWER_ON = powerOn;
    }

    @NacosValue(value = "${koubei.api.url:https://eco.taobao.com/router/rest}", autoRefreshed = true)
    public void setApiUrl(String apiUrl) {
        API_URL = apiUrl;
    }

    @NacosValue(value = "${koubei.app.secret:8e4844bc1b76a7621d595b314b59ed48}", autoRefreshed = true)
    public void setAppSecret(String appSecret) {
        APP_SECRET = appSecret;
    }

    @NacosValue(value = "${koubei.app.key:32986202}", autoRefreshed = true)
    public void setAppKey(String appKey) {
        APP_KEY = appKey;
    }

    @NacosValue(value = "${koubei.api.prepayMoney:0}", autoRefreshed = true)
    public void setPrepayMoney(int prepayMoney) {
        PREPAY_MONEY = prepayMoney;
    }
}
